MsgN("-- mdf_client.lua loaded")

include("cl_spawmenu.lua")

MDF.Timer = 0
MDF.Cash = 0.00

function MDF.GetInfo( umg )
	MDF.Timer = umg:ReadLong()
	MDF.Cash = umg:ReadFloat()
end
--hook to read info from the server
usermessage.Hook("MDF.GetInfo", MDF.GetInfo)


MDF.Huds = function()
	if !MDF.IsEnabled() then return end

	--build time
	if (MDF.Timer <= MDF.BuildTime) then
		MD.MakeHud({
			{"MadDog's Flood", "MDSBtip22", Color(255,255,0,255)},
			{{"Build Time Left:", SecondsToClock(MDF.BuildTime - MDF.Timer)}},
			{{"Cash Left:", "$" .. MDF.Cash}}
		},{position = "Top Right"})
		--waiting for round restart
	elseif (MDF.Timer >= (MDF.BuildTime + MDF.FloodTime)) then
		MD.MakeHud({
			{"MadDog's Flood", "MDSBtip22", Color(255,255,0,255)},
			{{"Round Restart In:", SecondsToClock((MDF.BuildTime + MDF.FloodTime + MDF.EndRoundTime) - MDF.Timer)}},
			{{"Cash Left:", "$" .. MDF.Cash}}
		},{position = "Top Right"})
	--flood time
	elseif (MDF.Timer >= MDF.BuildTime) then
		MD.MakeHud({
			{"MadDog's Flood", "MDSBtip22", Color(255,255,0,255)},
			{{"Flood Time Left:", SecondsToClock((MDF.BuildTime + MDF.FloodTime) - MDF.Timer)}},
			{{"Cash Left:", "$" .. MDF.Cash}}
		},{position = "Top Right"})
	end
end
--add hud hook
hook.Add("HUDPaint", "MDF.Huds", MDF.Huds)